function swap(arr, a, b) {
    let tmp = arr[a]
    arr[a] = arr[b]
    arr[b] = tmp
}

function bubbleSort(arr) {
    if (!arr || arr.length < 2) return
    for (let len = arr.length-1; len > 0; len --) {
        for (let i = 0;i < len; i++) {
            if (arr[i] > arr[i+1]) {
                swap(arr, i,i + 1)
            }
        }
    }
}

// for test
function sysSort(arr) {
    return arr.sort((a,b)=>a-b)
}

// 生成随机长度,随机大小的数组
function generateRandomArray(maxSize, maxValue) {
    let arr = Array(parseInt((maxSize+1) * Math.random()))
    for (let i = 0;i < arr.length; i++) {
        arr[i] = parseInt((maxValue + 1) * Math.random())  - parseInt((maxValue) * Math.random())
    }
    return arr
}

function copyArr(arr) {
    if (!arr || arr.length < 2) {
        return
    }
    let help = []
    for (let i = 0;i < arr.length;i ++) {
        help[i] = arr[i]
    }
    return help
}


function main() {
    let testTime = 50000;
    let maxSize = 100;
    let mxValue = 100;
    let succeed = true;
    for (let i = 0;i < testTime;i++) {
        // let arr1 =
    }
}








// function test() {
//     let arr = Array(50)
//     for (let i = 0;i < arr.length;i++) {
//         arr[i] = parseInt(Math.random()*100)
//     }
//     bubbleSort(arr)
//     console.log(arr)
//
// }
// test()

